home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / business / autorexx.lha / Rexx / XportSumm.rexx < prev   
OS/2 REXX Batch file  |  1996-12-10  |  2KB  |  91 lines

  1. /*
  2.     XportSumm.rexx - Collects, collates and writes summary data.
  3.     (c) 1996 Karl Mottram - Bifrost Industries
  4.     Started 0045 hrs - 06-12-96
  5.     Last Updated $VER: v1.1_(10-12-96) - Added running total calc...
  6. */
  7.  
  8. Init:
  9.     Signal On BREAK_C                /* Break Trapping      */
  10.     SpyFile = "LOGS:BioWare.log"        /* For Expansion       */
  11.     SummFile = "BIZ:Accounts/Fiscal/Overall.fsc"        /* Summary output file */
  12.     VarFile = "AutoRexx/JobBase.env"    /* ENV: and ENVARC:    */
  13.  
  14.     Address(TFJOB.1)
  15.     Options Results
  16.  
  17. CheckStatus:
  18.     GETFIELD Summ
  19.         If RESULT = 0 then signal Exzit
  20.  
  21. Collect:
  22.     GETFIELD JNum
  23.         InNum = RESULT
  24.     GETFIELD Amount
  25.         Income = RESULT
  26.     GETFIELD Costs
  27.         Purchs = RESULT
  28.  
  29. FormatDate:                        /*YYYYmmDD*/
  30.     TDay = Right(Date(s),2)            /*    ::||*/
  31.     TMon = Left(Right(Date(s),4),2)    /*    ||  */
  32.         ToDate = TDay||'-'||TMon
  33.         SavDat = Left(ToDate,9)
  34.  
  35. FormatRaw:
  36.     If Income = '' | Income = 'FREE' then do
  37.         SavInc = Left('-',7)
  38.         SavTot = "   -.--"
  39.         Signal FormatNext
  40.     end
  41.     else do
  42.         SavInc = Right(Income,7)
  43.             Call GetEnvs
  44.         NewTotal = RunTotal + Income
  45.             Call SaveEnvs
  46.         SavTot = Right(NewTotal,7)
  47.     end
  48.  
  49. FormatNext:
  50.     Blurk1 = "  "
  51.     Blurk2 = "  || -        "
  52.     If Purchs = '' then SavCst = Left('-',7)
  53.         else SavCst = Right(Purchs,7)
  54.     Blurk3 = "  -        -        "
  55.  
  56. Collate:
  57.     SummLine = SavDat||SavInc||Blurk1||SavTot||Blurk2||SavCst||Blurk3||InNum
  58.  
  59. SaveSumm:
  60. Open(Summ,SummFile,A)
  61.     Writeln(Summ,SummLine)
  62. Close(Summ)
  63.  
  64. Exzit:
  65.     Exit
  66.  
  67. GetEnvs:
  68. Open(Envs,'ENV:'VarFile,R)
  69.     RunTotal = Readln(Envs)
  70. Close(Envs)
  71.     Return
  72.  
  73. SaveEnvs:
  74. Open(Envs,'ENV:'VarFile,W)
  75.     Writeln(Envs,NewTotal)
  76. Close(Envs)
  77.     Address Command 'c:Copy ENV:'VarFile 'to ENVARC:'VarFile
  78.     Return
  79.  
  80. /* Output format data...
  81.  
  82.     10      7    2   7         14         7             20          4
  83.          !      ! !      !             !      !                   !
  84. 1234578901234567121234567123456789012341234567123456789012345678901234
  85. -----------------------------------------------------------------------
  86. Date:    Income:  Total:   || Phone    Purchs   Equip    Sundry   NOTE
  87. -----------------------------------------------------------------------
  88. 05-04    -        -        ||  150.00  -                 -        -Cel
  89. 24-04      95.00    95.00  || -        -        -        -        2021
  90. 03-05      85.00   180.00  || -        -        -        -        2022
  91. */